using System;
using System.Collections.Generic;
using System.Text;
using System.Data;using THSERP.BusinessEntities;using THSERP.BaseProvider;
using THSLib;using THSERP.BaseProvider;

namespace THSERP.Modules.EmployeeConfig
{
    public class EmployeeConfigEntities : ERPModuleEntities
    {
        #region Constants
        public const string strHRLevelsObject = "HRLevels";
        public const string strHRPositionsObject = "HRPositions";
        public const string strHRDepartmentsObject = "HRDepartments";
        #endregion

        #region Variables
        HRLevelsInfo _hRLevelsObject;
        HRPositionsInfo _hRPositionsObject;
        HRDepartmentsInfo _hRDepartmentsObject;

        public THSList<HRLevelsInfo> _lstHRLevels;
        public THSList<HRPositionsInfo> _lstHRPositions;
        public THSList<HRDepartmentsInfo> _lstHRDepartments;
        #endregion

        #region Public Properties
        public HRLevelsInfo HRLevelsObject
        {
            get
            {
                return _hRLevelsObject;
            }
            set
            {
                _hRLevelsObject = value;
            }
        }

        public HRPositionsInfo HRPositionsObject
        {
            get
            {
                return _hRPositionsObject;
            }
            set
            {
                _hRPositionsObject = value;
            }
        }

        public HRDepartmentsInfo HRDepartmentsObject
        {
            get
            {
                return _hRDepartmentsObject;
            }
            set
            {
                _hRDepartmentsObject = value;
            }
        }

        public THSList<HRLevelsInfo> HRLevelsList
        {
            get
            {
                return _lstHRLevels;
            }
            set
            {
                _lstHRLevels = value;
            }
        }

        public THSList<HRPositionsInfo> HRPositionsList
        {
            get
            {
                return _lstHRPositions;
            }
            set
            {
                _lstHRPositions = value;
            }
        }

        public THSList<HRDepartmentsInfo> HRDepartmentsList
        {
            get
            {
                return _lstHRDepartments;
            }
            set
            {
                _lstHRDepartments = value;
            }
        }
        #endregion

        #region Constructor
        public EmployeeConfigEntities()
            : base()
        {
            HRLevelsObject = new HRLevelsInfo();
            HRPositionsObject = new HRPositionsInfo();
            HRDepartmentsObject = new HRDepartmentsInfo();

            HRLevelsList = new THSList<HRLevelsInfo>();
            HRPositionsList = new THSList<HRPositionsInfo>();
            HRDepartmentsList = new THSList<HRDepartmentsInfo>();
        }
        #endregion

        #region Init Main Object,Module Objects functions
        public override void InitMainObject()
        {

        }

        public override void InitModuleObjects()
        {
            ModuleObjects.Add(EmployeeConfigEntities.strHRLevelsObject, HRLevelsObject);
            ModuleObjects.Add(EmployeeConfigEntities.strHRPositionsObject, HRPositionsObject);
            ModuleObjects.Add(EmployeeConfigEntities.strHRDepartmentsObject, HRDepartmentsObject);
        }

        public override void InitModuleObjectList()
        {
            HRLevelsList.InitTHSList(this, String.Empty, EmployeeConfigEntities.strHRLevelsObject);
            HRPositionsList.InitTHSList(this, String.Empty, EmployeeConfigEntities.strHRPositionsObject);
            HRDepartmentsList.InitTHSList(this, String.Empty, EmployeeConfigEntities.strHRDepartmentsObject);
        }

        public override void InitGridControlInTHSList()
        {
            HRLevelsList.InitTHSListGridControl();
            HRPositionsList.InitTHSListGridControl();
            HRDepartmentsList.InitTHSListGridControl();
        }

        public override void SetDefaultModuleObjectsList()
        {
            try
            {
                HRLevelsList.SetDefaultListAndRefreshGridControl();
                HRPositionsList.SetDefaultListAndRefreshGridControl();
                HRDepartmentsList.SetDefaultListAndRefreshGridControl();
            }
            catch (Exception)
            {
                return;
            }
        }

        #endregion

        public override void InitModuleEntity()
        {
            base.InitModuleEntity();

            UpdateModuleObjectBindingSource(EmployeeConfigEntities.strHRLevelsObject);
            UpdateModuleObjectBindingSource(EmployeeConfigEntities.strHRPositionsObject);
            UpdateModuleObjectBindingSource(EmployeeConfigEntities.strHRDepartmentsObject);
        }
        #region Invalidate Module Objects functions
        public override void InvalidateModuleObjects(int iObjectID)
        {
            
        }
        #endregion

        #region Save Module Objects functions
        public override void SaveModuleObjects()
        {

        }
        #endregion
    }
}
